using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;

namespace HappySprite.Simulation
{
    public class HalfPlane : CollisionShape
    {
        Vector2 normal;

        public HalfPlane(Vector2 normal)
        {
            this.normal = normal;
        }

        public Vector2 Normal
        {
            get { return normal; }
            set 
            {
                if (normal == Vector2.Zero)
                    throw new InvalidOperationException("Normal cannot be zero vector.");

                normal = Vector2.Normalize(value); 
            }
        }

        public override ShapeType ShapeType
        {
            get { return ShapeType.HalfPlane; }
        }

        public override BoundingRectangle GetBounds(Transform2D t)
        {
            return new BoundingRectangle(
                float.NegativeInfinity, float.NegativeInfinity, 
                float.PositiveInfinity, float.PositiveInfinity);
        }

        public override Vector2 SupportMapping(Vector2 v)
        {
            throw new NotSupportedException("Support mapping for half plane not supported.");
        }
    }
}
